Skip to content

fix(filesystem): document glob pattern syntax for search_files and directory_tree - #4771

Open
Pranav-Nexus wants to merge 1 commit into
modelcontextprotocol:mainfrom
Pranav-Nexus:fix/filesystem-search-glob-schema
Open

fix(filesystem): document glob pattern syntax for search_files and directory_tree#4771
Pranav-Nexus wants to merge 1 commit into
modelcontextprotocol:mainfrom
Pranav-Nexus:fix/filesystem-search-glob-schema

Conversation

@Pranav-Nexus

@Pranav-Nexus Pranav-Nexus commented Sep 7, 2026

Copy link
Copy Markdown

Summary

Clarifies that search_files and directory_tree accept glob patterns (matching paths relative to the working directory) in their tool schemas.

Motivation

When autonomous AI agents (such as Claude or Cursor) invoke search_files, models occasionally attempt to supply regexes or plain filenames without wildcards because the schema parameters (pattern and excludePatterns) did not document the expected glob syntax or examples.

Adding explicit glob format descriptions (e.g., '*.ts', '**/*.json', ['**/node_modules/**']) directly to the Zod schema ensures models format search queries accurately on the first invocation without trial-and-error retries.

Changes

  • Documented pattern on search_files as expecting a glob pattern.
  • Documented excludePatterns on search_files and directory_tree as an array of glob exclusion patterns.
  • Zero functional or breaking changes to existing parameter contracts.

Verification

  • Built successfully via npm run build (TypeScript compilation cleanly generated dist/).
  • Unit tests run via vitest.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant